<%--
  User: MaxMin
  Date: 2015/8/27 0027
  Time: 14:54
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>修改密码</title>
<link href='http://static.image.alimmdn.com/favicon.ico?t=123654' rel="shortcut icon" />
<link rel="stylesheet" type="text/css" href="http://apps.bdimg.com/libs/fontawesome/4.2.0/css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="<c:url value='css/login.css'/>">
<link rel="stylesheet" type="text/css" href="<c:url value='css/message/messenger.css'/>">
<link rel="stylesheet" type="text/css" href="<c:url value='css/message/messenger-theme-flat.css'/>">
<style>
html,body {
	width: 100%;
	font-family: "Microsoft Yahei", Helvetica, Arial, sans-serif;
}
* {
    box-sizing: initial;-webkit-box-sizing: initial;
}
a {
	color: #3d4450;
}
</style>

</head>
<body>
	<div class="main">
		<div class="center">
			<form action='<c:url value="/confirm"/>' id="loginForm" method="post" onsubmit="return submitB()">
				<i class="fa fa-user Cone"> | </i> 
				<input type="text" autocomplete="off" name="username" id="username" placeholder="用户名" onblur="checkUser()" /> 
				<span id="user_pass"></span> <br /> 
				<i class="fa fa-key Cone"> | </i> 
				<input type="password" autocomplete="off" name="password" id="password" placeholder="旧密码" onblur="checkUser1()" /> 
				<span id="pwd_pass"></span> <br /> 
				<i class="fa fa-key Cone"> | </i> 
				<input type="password" autocomplete="off" name="newpassword1" id="newpassword1" placeholder="新密码" onblur="checkNewPassword1()" /> 
				<i class="fa fa-key Cone"> | </i> 
				<input type="password" autocomplete="off" name="newpassword2" id="newpassword2" placeholder="再输入一次新密码" onblur="checkNewPassword2()" /> 
				<i class="fa fa-folder-open Cone"> | </i> 
				<input style="padding-left: 0" type="submit" value="确认修改" id="submit" name="submit"/>
				<br />
			</form>
		</div>
		<div style="text-align: center;">
			<p>
				Copyright © 2014 MaxMin. All Rights Reserved. <a
					href="http://www.miitbeian.gov.cn">苏ICP备14010751号-1</a>
			</p>
		</div>
	</div>

	<script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/1.11.3/jquery.min.js"></script>
	<script type="text/javascript" src='<c:url value="Js/message/messenger.min.js"/>'></script>
	<script type="text/javascript" src='<c:url value="Js/message/messenger-theme-flat.js"/>'></script>
	<script type="text/javascript">
		$(function(){
			Messenger.options = {
			    extraClasses: 'messenger-fixed messenger-on-bottom messenger-on-right',
			    theme: 'flat'
			}
			/* if("${shiroLoginFailure}"){
				console.log("${shiroLoginFailure}");
				Messenger().post({
				  	message: "${shiroLoginFailure}",
				  	type: 'error',
				  	showCloseButton: true
				});
			} */
			if("${error}"){
				console.log("${error}");
				Messenger().post({
				  	message: "${error}",
				  	type: 'error',
				  	showCloseButton: true
				});
			}
			
			/* Messenger().post({
			  	message: 'There was an explosion while processing your request.',
			  	type: 'error',
			  	showCloseButton: true
			}); */
		});
		
		function alertClose(){
			$("#message").alert('close');
		}
		//获取input的所有id
		var user = document.getElementById("username");
		var pwd = document.getElementById("password");
		var pwd1 = document.getElementById("newpassword1");
		var pwd2 = document.getElementById("newpassword2");
		var surePwd = document.getElementById("surePwd");
		//获取span的所有id
		var user_pass = document.getElementById("user_pass");
		var pwd_pass = document.getElementById("pwd_pass");
		var surePwd_pass = document.getElementById("surePwd_pass");
		function checkUser() {
			//如果昵称未输入，则提示输入昵称
			if (!user.value) {
				user_pass.style.fontSize = "13px";
				user_pass.style.width = "31%";
				user_pass.style.height = "2em";
				user_pass.style.textAlign = "center";
				user_pass.style.lineHeight = "2em";
				user_pass.style.marginTop = '0.05%'
				user_pass.innerHTML = '你还没有填写用户名哦。';
				user_pass.style.display = "block";
			} else if (user.value) {
				user_pass.style.display = "none";
			}
		}

		//输入密码提示
		function checkUser1() {
			//如果未输入密码，则提示请输入密码
			if (!pwd.value) {
				pwd_pass.style.fontSize = "13px";
				pwd_pass.style.width = "31%";
				pwd_pass.style.height = "2em";
				pwd_pass.style.textAlign = "center";
				pwd_pass.style.lineHeight = "2em";
				pwd_pass.innerHTML = '你还没有填写密码哦。';
				pwd_pass.style.display = "block";
			} else {
				pwd_pass.innerHTML = '';
				pwd_pass.style.backgroundColor = "#fff";
				pwd_pass.style.border = "none";
				pwd_pass.style.display = "none";

			}

		}
		//输入密码提示
		function checkNewPassword1() {
			//如果未输入密码，则提示请输入密码
			if (!pwd1.value) {
				alert('请输入新密码');
			} else {

			}

		}
		//输入密码提示
		function checkNewPassword2() {
			//如果未输入密码，则提示请输入密码
			if (!pwd2.value) {
				alert('请再次输入新密码');
			} else {
				if(pwd1.value!=pwd2.value){
				alert('密码不一致，请重新输入');
				}else{
				}

			}

		}

		//确认密码提示
		function checkUser2() {
			//再次确认密码
			if (!surePwd.value) {
				surePwd_pass.style.fontSize = "13px";
				surePwd_pass.style.width = "31%";
				surePwd_pass.style.height = "2em";
				surePwd_pass.style.textAlign = "center";
				surePwd_pass.style.lineHeight = "2em";
				surePwd_pass.innerHTML = '你还没有填写验证码哦';
				surePwd_pass.style.display = "block";
			}

			else {
				surePwd_pass.innerHTML = '';
				surePwd_pass.style.backgroundColor = "#fff";
				surePwd_pass.style.border = "none";
				surePwd_pass.style.display = "none";
			}
		}

		function submitB() {
			if (!user.value) {
				user_pass.style.fontSize = "13px";
				user_pass.style.width = "31%";
				user_pass.style.height = "2em";
				user_pass.style.textAlign = "center";
				user_pass.style.lineHeight = "2em";
				user_pass.innerHTML = '请填写您的用户名。';
				user.focus();
				return false;
			}
			if (!pwd.value) {
				pwd_pass.style.fontSize = "13px";
				pwd_pass.style.width = "31%";
				pwd_pass.style.height = "2em";
				pwd_pass.style.textAlign = "center";
				pwd_pass.style.lineHeight = "2em";
				pwd_pass.innerHTML = '请填写您的用户密码。';
				pwd.focus();
				return false;
			}
			if (!pwd1.value) {
				alert('请输入新密码');
				pwd1.focus();
				return false;
			}
			if (!pwd2.value) {
				alert('请再次输入新密码');
				pwd2.focus();
				return false;
			}
				return true;
		}
	</script>
</body>
</html>